package gerneric

object GenericDemo02 {
  def main(args: Array[String]): Unit = {
    val class01 = new EnglishClass[SeasonEnum.SeasonEnum, String, String](SeasonEnum.spring, "01-班", "高级班")
    println(class01)
    new EnglishClass[SeasonEnum.SeasonEnum, String, Int](SeasonEnum.winter, "02-Class", 2014001)

    SourceType.values.foreach(println)
    val sourceType = SourceType.withName("kafka")
    println(sourceType)

  }

}

class EnglishClass[A, B, C](val classSeason: A, val className: B, val classType: C) {

  override def toString = s"EnglishClass(classSeason=$classSeason, className=$className, classType=$classType)"
}

//枚举类型
object SeasonEnum extends Enumeration {
  type SeasonEnum = Value //取一个别名
  val spring, autumn, summer, winter = Value
}

object SourceType extends Enumeration {
  type SourceType = Value
  val kafka, Avro = Value
  val Custom = Value(5, "socket")

}
